package com.soft.manage.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

import com.soft.common.utils.DateUtils;
import com.soft.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.soft.manage.mapper.CustomUserMapper;
import com.soft.manage.domain.CustomUser;
import com.soft.manage.service.ICustomUserService;

/**
 * 客户信息Service业务层处理
 *
 * @author mobin
 * @date 2025-05-31
 */
@Service
public class CustomUserServiceImpl extends ServiceImpl<CustomUserMapper, CustomUser> implements ICustomUserService {
    @Autowired
    private CustomUserMapper customUserMapper;

    /**
     * 查询客户信息
     *
     * @param id 客户信息主键
     * @return 客户信息
     */
    @Override
    public CustomUser selectCustomUserById(Long id) {
        return customUserMapper.selectCustomUserById(id);
    }

    /**
     * 查询客户信息列表
     *
     * @param customUser 客户信息
     * @return 客户信息
     */
    @Override
    public List<CustomUser> selectCustomUserList(CustomUser customUser) {
        return customUserMapper.selectCustomUserList(customUser);
    }

    /**
     * 新增客户信息
     *
     * @param customUser 客户信息
     * @return 结果
     */
    @Override
    public int insertCustomUser(CustomUser customUser) {
        customUser.setCreateTime(DateUtils.getNowDate());
        customUser.setCreateBy(SecurityUtils.getUsername());
        return customUserMapper.insertCustomUser(customUser);
    }

    /**
     * 修改客户信息
     *
     * @param customUser 客户信息
     * @return 结果
     */
    @Override
    public int updateCustomUser(CustomUser customUser) {
        customUser.setUpdateTime(DateUtils.getNowDate());
        customUser.setUpdateBy(SecurityUtils.getUsername());
        return customUserMapper.updateCustomUser(customUser);
    }

    /**
     * 批量删除客户信息
     *
     * @param ids 需要删除的客户信息主键
     * @return 结果
     */
    @Override
    public int deleteCustomUserByIds(Long[] ids) {
        return customUserMapper.deleteCustomUserByIds(ids);
    }

    /**
     * 删除客户信息信息
     *
     * @param id 客户信息主键
     * @return 结果
     */
    @Override
    public int deleteCustomUserById(Long id) {
        return customUserMapper.deleteCustomUserById(id);
    }
}
